package design.mode.model.composite;


/**
 * @author ldanniel
 * @description todo
 * @date 2023/09/17:43
 * @since jdk11
 */
public class MenuTree {
    protected MenuComponent getMenu() {
        //菜单树
        //菜单管理
        MenuComponent menuManagement = new Menu.Builder()
                .id("GN001D001")
                .parentId("GN001D001")
                .menuLevel(2)
                .menuName("菜单管理")
                .url("/menu")
                .effective(true)
                .build();
        //子菜单
        menuManagement.add(new MenuItem.Builder()
                .id("GN001D00101")
                .parentId("GN001D001")
                .menuLevel(3)
                .menuName("页面访问")
                .url("/menu/pageAccess")
                .effective(true)
                .build());
        menuManagement.add(new MenuItem.Builder()
                .id("GN001D00102")
                .parentId("GN001D001")
                .menuLevel(3)
                .menuName("展开菜单")
                .url("/menu/expand")
                .effective(true)
                .build());
        menuManagement.add(new MenuItem.Builder()
                .id("GN001D00103")
                .parentId("GN001D001")
                .menuLevel(3)
                .menuName("编辑菜单")
                .url("/menu/edit")
                .effective(true)
                .build());
        menuManagement.add(new MenuItem.Builder()
                .id("GN001D00104")
                .parentId("GN001D001")
                .menuLevel(3)
                .menuName("删除菜单")
                .url("/menu/delete")
                .effective(true)
                .build());
        menuManagement.add(new MenuItem.Builder()
                .id("GN001D00105")
                .parentId("GN001D001")
                .menuLevel(3)
                .menuName("新增菜单")
                .url("/menu/add")
                .effective(true)
                .build());
        //角色管理
        MenuComponent roleManagement = new Menu.Builder()
                .id("GN001D002")
                .parentId("GN001D001")
                .menuLevel(2)
                .menuName("角色管理")
                .url("/role")
                .effective(true)
                .build();
        //子菜单
        roleManagement.add(new MenuItem.Builder()
                .id("GN001D00201")
                .parentId("GN001D002")
                .menuLevel(3)
                .menuName("页面访问")
                .url("/role/pageAccess")
                .effective(true)
                .build());
        roleManagement.add(new MenuItem.Builder()
                .id("GN001D00202")
                .parentId("GN001D002")
                .menuLevel(3)
                .menuName("新增角色")
                .url("/role/addRole")
                .effective(true)
                .build());
        roleManagement.add(new MenuItem.Builder()
                .id("GN001D00203")
                .parentId("GN001D002")
                .menuLevel(3)
                .menuName("修改角色")
                .url("/role/updateRole")
                .effective(true)
                .build());
        //权限管理
        MenuComponent permissionManagement = new Menu.Builder()
                .id("GN001D003")
                .parentId("GN001D001")
                .menuLevel(2)
                .menuName("权限管理")
                .url("/permission")
                .effective(true)
                .build();
        //子菜单
        permissionManagement.add(new MenuItem.Builder()
                .id("GN001D00301")
                .parentId("GN001D003")
                .menuLevel(3)
                .menuName("页面访问")
                .url("/permission/pageAccess")
                .effective(true)
                .build());
        permissionManagement.add(new MenuItem.Builder()
                .id("GN001D00302")
                .parentId("GN001D003")
                .menuLevel(3)
                .menuName("提交保存")
                .url("/permission/submit")
                .effective(true)
                .build());

        //一级菜单,"0",,,true
        MenuComponent mainMenu = new Menu.Builder()
                .id("GN001D001")
                .parentId("0")
                .menuLevel(0)
                .menuName("系统管理")
                .url("/admin")
                .effective(true)
                .build();

        MenuComponent rootMenu = new Menu.Builder().build();
        //一级菜单
        rootMenu.add(mainMenu);
        //二级菜单
        rootMenu.add(menuManagement);
        rootMenu.add(roleManagement);
        rootMenu.add(permissionManagement);
        return rootMenu;
    }
}
